# -*- coding: utf-8 -*-
# @Time    : 2025/1/22 上午11:46
# @Author  : lh
# @Email   : lhhlhh822@peatlmail.com
# @File    : err_test_look_schedule.py
# @Software: PyCharm
from selenium.webdriver.common.by import By
from pages.base_page import BasePage


class HomePage(BasePage):
    url = '/crm/index.php?m=dynamic&a=index'
    success_tips_locator = (By.CSS_SELECTOR, 'body > div.container > div.alert.alert-success')
    clew_btn_locator = (By.LINK_TEXT, '线索')  #线索
    client_btn_locator = (By.LINK_TEXT, '客户')  #客户
    business_opportunity_btn_locator = (By.LINK_TEXT, '商机')  #商机
    task_btn_locator = (By.LINK_TEXT, '任务')  #任务
    contract_btn_locator = (By.LINK_TEXT, '合同')  #合同
    result_locator = (By.XPATH, '/html/body/div[5]/div[2]')

    #登录成功提示语
    def success_tips_text(self):
        success_tips_element = self.driver.find_element(*self.success_tips_locator)
        return success_tips_element.text.strip()  #页面

    #首页页面的线索
    def click_clew(self):
        self.find_element(self.clew_btn_locator).click()  #线索

    #首页页面的客户
    def click_client(self):
        self.find_element(self.client_btn_locator).click()  #客户

    #首页页面的商机按钮

    def click_business_opportunity(self):
        self.find_element(self.business_opportunity_btn_locator).click()  #商机

    #首页页面的任务按钮

    def click_task(self):
        self.find_element(self.task_btn_locator).click()  #任务

    #首页页面的合同按钮
    def click_contract(self):
        self.find_element(self.contract_btn_locator).click()  #合同
